package com.jsnkj.basic.fragment.earnings

import androidx.lifecycle.MutableLiveData
import com.jsnkj.basic.bean.ErrorEntity
import com.jsnkj.basic.bean.PopularizeBillsEntity
import com.jsnkj.basic.http.HttpApiService
import com.jsnkj.basic.mvvm.HttpViewModel
import com.yang.http.HttpRequest

class DailyBillingViewModel : HttpViewModel() {

    var postHttpResult: MutableLiveData<PopularizeBillsEntity> = MutableLiveData()

    var errorResult: MutableLiveData<ErrorEntity> = MutableLiveData()

    /**
     * 获取首页app列表数据
     */
    fun postAppList() {
        launchHttp({
            HttpRequest.getService(HttpApiService::class.java).postPopularizeBills()
        }, onResult = { it ->
//            LogUtils.e("获取首页app列表数据 请求成功：$it")
            postHttpResult.value = it
        }, onFailed = { code, msg ->
            errorResult.value = ErrorEntity.getInstance(code,msg)
        }) {
        }
    }

}